import 'dart:io';

import 'package:flutter/material.dart';

class ImageDetailDialog extends StatelessWidget {
  final String url;

  const ImageDetailDialog({Key? key, required this.url}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Material(
        type: MaterialType.transparency,
        child: Center(
          child: Container(
              constraints: BoxConstraints(
                maxWidth: MediaQuery.of(context).size.width * 0.72,
              ),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(8),
                color: Colors.white,
              ),
              // padding: const EdgeInsets.all(15),
              child: GestureDetector(
                child: Image.file(
                  File(url),
                  fit: BoxFit.contain,
                ),
                onTap: () {
                  Navigator.pop(context);
                },
              )),
        ));
  }
}

showImageDetail({required BuildContext context, required String url}) {
  showDialog(
      context: context,
      builder: (context) {
        return ImageDetailDialog(url: url);
      });
}
